package com.aob.resolver;

import org.springframework.web.servlet.view.InternalResourceView;

import java.io.File;
import java.util.Locale;

/**
 * @author Administrator
 * @create 2018/9/17
 */
public class HtmlViewResolver extends InternalResourceView {
    //this.getServletContext().getRealPath("/")  http://localhost:8080/ch10/
    //this.getUrl()    http://localhost:8080/ch10/WEB-INF/jsp/welcome.html
    @Override
    public boolean checkResource(Locale locale) throws Exception {
        File file = new File(
                this.getServletContext().getRealPath("/"), this.getUrl()
        );
        return file.exists();
    }
}
